import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    comment: '',
    submitBlog: false
  },
  mutations: {
    /**
     * 提交comment
     * @method setComment
     * @param state
     */
    setComment (state, content) {
      state.comment = content
    },
    /**
     * 提交回复
     * @method setSubmitBlog
     * @param state
     */
    setSubmitBlog (state, flag) {
      state.submitBlog = !flag
    }
  },
  getters: {
    /**
     * 获取comment内容
     * @method getComment
     * @param {*} state
     */
    getComment (state) {
      return state.comment
    },
    /**
     * 获取是否点击了发布按钮
     * @method getComment
     * @param {*} state
     */
    getSubmitBlog (state) {
      return state.submitBlog
    }
  },
  actions: {
  },
  modules: {
  }
})
